package cn.wyl.feignclient;

import cn.wyl.domain.User;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserFeignFallBackFactory implements FallbackFactory<IUserFeignClient> {
    /*
     @Override
    public Object create(Throwable throwable) {
        return null;
    }*/
    @Override
    public IUserFeignClient create(Throwable throwable) {
        throwable.printStackTrace();
        return id-> new User(id,"网络异常");
        /*
            new IUserFeignClient(){
                @Override
                public User get(Long id){
                    return null;
                }
            };
         */

    }

}
